package org.seckill.mapper;

import java.util.List;
import org.apache.ibatis.annotations.DeleteProvider;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.annotations.UpdateProvider;
import org.apache.ibatis.type.JdbcType;
import org.seckill.model.SeckillView;
import org.seckill.model.SeckillViewCriteria;

public interface SeckillViewMapper {
    @SelectProvider(type=SeckillViewSqlProvider.class, method="countByExample")
    long countByExample(SeckillViewCriteria example);

    @DeleteProvider(type=SeckillViewSqlProvider.class, method="deleteByExample")
    int deleteByExample(SeckillViewCriteria example);

    @Insert({
        "insert into seckill_view (seckill_id, user_phone, ",
        "state, create_time, ",
        "name, number, start_time, ",
        "end_time, seckill_create_time)",
        "values (#{seckillId,jdbcType=BIGINT}, #{userPhone,jdbcType=BIGINT}, ",
        "#{state,jdbcType=TINYINT}, #{createTime,jdbcType=TIMESTAMP}, ",
        "#{name,jdbcType=VARCHAR}, #{number,jdbcType=INTEGER}, #{startTime,jdbcType=TIMESTAMP}, ",
        "#{endTime,jdbcType=TIMESTAMP}, #{seckillCreateTime,jdbcType=TIMESTAMP})"
    })
    int insert(SeckillView record);

    @InsertProvider(type=SeckillViewSqlProvider.class, method="insertSelective")
    int insertSelective(SeckillView record);

    @SelectProvider(type=SeckillViewSqlProvider.class, method="selectByExample")
    @Results({
        @Result(column="seckill_id", property="seckillId", jdbcType=JdbcType.BIGINT),
        @Result(column="user_phone", property="userPhone", jdbcType=JdbcType.BIGINT),
        @Result(column="state", property="state", jdbcType=JdbcType.TINYINT),
        @Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="name", property="name", jdbcType=JdbcType.VARCHAR),
        @Result(column="number", property="number", jdbcType=JdbcType.INTEGER),
        @Result(column="start_time", property="startTime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="end_time", property="endTime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="seckill_create_time", property="seckillCreateTime", jdbcType=JdbcType.TIMESTAMP)
    })
    List<SeckillView> selectByExample(SeckillViewCriteria example);

    @UpdateProvider(type=SeckillViewSqlProvider.class, method="updateByExampleSelective")
    int updateByExampleSelective(@Param("record") SeckillView record, @Param("example") SeckillViewCriteria example);

    @UpdateProvider(type=SeckillViewSqlProvider.class, method="updateByExample")
    int updateByExample(@Param("record") SeckillView record, @Param("example") SeckillViewCriteria example);
}